import os
import sys

from cx_Freeze import setup, Executable

# 创建可执行文件的配置
executableApp = Executable(
    script="app.py",
    target_name="pyapp",
)

# 打包的参数配置
options = {
    "build_exe": {
        "build_exe": "./dist/",
        "excludes": ["*.txt"],
        "optimize": 2,
        "include_files": [("modbus-client.db", "modbus-client.db")],  # 将数据库文件打包,
        "packages": ["sqlalchemy", "sqlite3", "pymodbus"],  # 确保 SQLAlchemy 和 SQLite 被打包
    }
}

setup(
    name="pyapp",
    version="1.0",
    description="python app",
    options=options,
    executables=[executableApp]
)
